Skip to content

Augment audio system with the ability to have captions #5567

Open
sowelipililimute wants to merge 2 commits intospace-wizards:masterfrom
sowelipililimute:work/jblackquill/caption
Open

Augment audio system with the ability to have captions #5567
sowelipililimute wants to merge 2 commits intospace-wizards:masterfrom
sowelipililimute:work/jblackquill/caption

Conversation

@sowelipililimute
Copy link
Copy Markdown
Member

@sowelipililimute sowelipililimute commented Dec 22, 2024

Mainly manages CaptionComponents attached to the audio entities whenever they should display a visible caption. Can't use a Caption field on the AudioComponent due to the ComponentTreeSystem wanting to listen to the ComponentStartup/ComponentShutdown events that are already being listened to by the client AudioSystem.

@sowelipililimute sowelipililimute changed the title Augment audio system with the ability to have captions Draft: Augment audio system with the ability to have captions Dec 22, 2024
@sowelipililimute sowelipililimute force-pushed the work/jblackquill/caption branch 2 times, most recently from 1d44d43 to b068a43 Compare February 23, 2025 16:41
@sowelipililimute sowelipililimute force-pushed the work/jblackquill/caption branch 2 times, most recently from f9453c9 to 7eb4fe9 Compare May 1, 2025 17:28
@sowelipililimute sowelipililimute changed the title Draft: Augment audio system with the ability to have captions Augment audio system with the ability to have captions May 1, 2025
@sowelipililimute sowelipililimute marked this pull request as ready for review May 1, 2025 17:29
Comment thread Robust.Client/Audio/AudioSystem.cs Outdated
Comment thread Robust.Client/Audio/AudioSystem.cs Outdated
Comment thread Robust.Client/ComponentTrees/CaptionTreeSystem.cs
Comment thread Robust.Client/ComponentTrees/CaptionTreeSystem.cs Outdated
@sowelipililimute sowelipililimute force-pushed the work/jblackquill/caption branch from 7eb4fe9 to 0e5304d Compare June 24, 2025 23:49
@sowelipililimute sowelipililimute marked this pull request as draft June 25, 2025 01:28
@sowelipililimute sowelipililimute force-pushed the work/jblackquill/caption branch from 0e5304d to c355575 Compare July 4, 2025 00:53
@sowelipililimute sowelipililimute marked this pull request as ready for review July 4, 2025 04:23

private void OnAudioPaused(EntityUid uid, AudioComponent component, ref EntityPausedEvent args)
{
if (_captionQuery.TryGetComponent(uid, out var caption) && EntityManager.TryGetComponent(uid, out TransformComponent? xform))
Copy link
Copy Markdown
Member

@slarticodefast slarticodefast Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to do a TryComp for the TransformComponent, all entities have that component.
And if it was deleted the first one would fail.
So you can just use the Transform(uid) shorthand, which uses a query

public sealed partial class CaptionComponent : Component, IComponentTreeEntry<CaptionComponent>
{
[DataField, AutoNetworkedField]
public LocId? Caption { get; set; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add documentation to all of these

public string ID { get; private set; } = default!;

[DataField]
public LocId? Caption { get; private set; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants